<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:xi="http://www.w3.org/2001/XInclude"
      xmlns:py="http://genshi.edgewall.org/">
    <xi:include href="master.html" />

<?python from mnemoply import model ?>

<head />

<body>
    <div align="center">
        [ <a href="./">Back</a> ]
        <br />
        <span>Transfer history</span>:
        <span>${obj.model_title}</span>:
        <span>${obj.title}</span>
    </div>

    <br />

    <table class="maintable">
        <thead>
        <tr>
            <th>Order</th>
            <th>Action</th>
            <th>From</th>
            <th>To</th>
            <th>Info</th>
            <th>Comment</th>
        </tr>
        </thead>

        <tbody>
            <tr py:for="t in model.Transfer.selectBy(student=obj)">
                <td>
                    <a href="/Order/${t.order.id}/">
                        <span>${t.order.creationDate}</span>,
                        <span>${t.order.id}</span>
                    </a>
                </td>

                <span py:if="not t.groupFrom and t.groupTo" py:strip="True">
                    <td>Inclusion</td>
                    <td>-</td>
                    <td>${t.groupTo.title}</td>
                    <td>
                        <span py:if="t.planned">planned inclusion</span>
                    </td>
                </span>

                <span py:if="t.groupFrom and t.groupTo" py:strip="True">
                    <td>Transfer</td>
                    <td>${t.groupFrom.title}</td>
                    <td>${t.groupTo.title}</td>
                    <td>
                        <span py:if="t.planned">planned transfer</span>
                    </td>
                </span>

                <span py:if="t.groupFrom and not t.groupTo" py:strip="True">
                    <td>Discharge</td>
                    <td>${t.groupFrom.title}</td>
                    <td>-</td>
                    <td>
                        <span py:if="t.planned">planned discharge <br /></span>
                        <span py:if="t.discharge.reason">
                            <span>Reason</span>:
                            <span>${t.discharge.reason}</span>
                            <br />
                        </span>

                        <span>Self wish</span>:
                        <span py:if="t.discharge.isSelfWish">Yes</span>
                        <span py:if="not t.discharge.isSelfWish">No</span>
                    </td>
                </span>

                <td py:content="t.comment and t.comment or '-'" />
            </tr>
        </tbody>
    </table>
</body>
</html>
